{% extends "base.html" %}

{% block head_title %} ravings {{ block.super }} {% endblock head_title %}

{% block sidebar %}
  {% include "blog/sidebar.html" %}
{% endblock sidebar %}

{% block subnav_description %}
  {% include "blog/subnav_desc.html" %}
{% endblock subnav_description %}


{% block content %}
  {% load comments %}
  {% load comment_utils %}
  {% load tagging_tags %}

  {% tags_for_object object as post_tags %}
  <div class="blogpost">
    {% spaceless %}
    {% if object.enable_comments %}
    {% get_public_free_comment_count for blog.post object.id as comment_count %}
    {% endif %}
    <h2 class="posts"><a id="{{ object.slug }}" href="{{ object.get_absolute_url }}">{{ object.title }}</a></h2>

    <br/>
    {{ object.body|safe }}

    {% if object.enclosure %}<a href="{{ object.get_enclosure_url }}">Download Podcast</a> {% endif %}
    <br/>
    <br/>

    <div class="article_menu">
      <b>Posted on {{ object.pub_date|date:"F j, Y" }} at {{ object.pub_date|date:"P"}} </b> 
      {% if object.enable_comments %}
      | <a href="{{ object.get_absolute_url }}#comments" class='commentlink'>{{ comment_count }} Comment{{ comment_count|pluralize }}</a>
      {% endif %}
      <br/>
      <span class="tags">Tags: {% for tag in post_tags %}{% if not forloop.first %}, {% endif %}<a href="/b/tags/{{ tag }}/">{{ tag }}</a>{% endfor %}</span>
    </div>

    {% endspaceless %}
  </div>

  {% if object.enable_comments %}
    {% spaceless %}
    {% get_public_free_comment_list for blog.post object.id as comment_list %}
    <br/>

    {% if comment_list %}
    <h2 id="comments">Comments</h2>
    {% endif %}

    <br/>

    {% for comment in comment_list %}
      <div class="comment_{% cycle odd,even %}" id="c{{ comment.id }}">
        <span class="comnum"><a href="#c{{ comment.id }}">#{{ forloop.counter }}</a></span>
        <p><b>{{ comment.person_name }}</b> commented on {{ comment.submit_date|date:"F j, Y" }} at {{ comment.submit_date|date:"P" }}:</p>
        {{ comment.comment|escape|urlizetrunc:40|linebreaks }}
      </div>
    {% endfor %}

    <h2 class="comments">Post a comment</h2>
    <br/>

    {% free_comment_form for blog.post object.id %}
    {% endspaceless %}
  {% endif %}
{% endblock content %}
